package com.gitee.cashzhang27.test.boot.i18n.config;

import com.gitee.cashzhang27.test.boot.i18n.component.MyLocaleResolver;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.LocaleResolver;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

/**
 * @author Cash Zhang
 * @version v1.0
 * @since 2019/07/09 10:35
 */
@Configuration
public class MyMvcConfig extends WebMvcConfigurerAdapter {


  @Override
  public void addViewControllers(ViewControllerRegistry registry) {
    registry.addViewController("/token/login").setViewName("login");
  }

  @Bean
  public LocaleResolver localeResolver() {
    return new MyLocaleResolver();
  }

}
